package se.webbzon.boltzmann.game.event;

import se.webbzon.boltzmann.game.npc.GameNPC;
import se.webbzon.boltzmann.game.npc.GuardingDuty;
import se.webbzon.boltzmann.game.sequence.Sequence;
import se.webbzon.oschi01.worldarea.WorldArea;
import se.webbzon.oschi01.worldobject.WorldObject;
import se.webbzon.oschi01.worldobject.WorldStaticObject;

public class NPCGuardEvent extends AbstractTargetEvent {
	
	// The binding of this non-player character event
	private final WorldObject binding;
	
	/*============================================================
	Constructors
	============================================================*/
	
	public NPCGuardEvent(Sequence sequence, WorldObject binding, String[] arguments) {
		super(sequence,arguments);
		this.binding = binding;
	}
	
	/*============================================================
	Public Methods
	============================================================*/

	@Override protected void onBegin(WorldArea world) {
		WorldObject target = getTarget();
		if (binding instanceof GameNPC && target instanceof WorldStaticObject) {
			GameNPC npc = (GameNPC) binding;
			npc.forceDuty(new GuardingDuty(npc, (WorldStaticObject) target));
		}
		end();
	}

	@Override protected void onEnd() {};

}
